<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
  <!ENTITY dc "http://purl.org/dc/elements/1.1/">
  <!ENTITY dcterms "http://purl.org/dc/terms/">
  <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
  <!ENTITY a "http://xmlns.heustics.org/schema/myelin/0.1/">
  <!ENTITY m "http://xmlns.heustics.org/ontology/myelin/0.1/">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:a="http://xmlns.heustics.org/schema/myelin/0.1/"
  xmlns:o="http://xmlns.heustics.org/schema/myelin/0.1/Section#view"
  xmlns:l="http://xmlns.heustics.org/schema/i18n/0.1/"
  exclude-result-prefixes="xsl a o l"
>
  <xsl:variable name="o:l10n" select="a:get-l10n('&a;Section#view')"/>
  <xsl:variable name="o:new-actions-l10n" select="$o:l10n/l:context[@name='new-actions']/*"/>
  
  <xsl:template match="a:acl[@action='new-entry' or @action='new-section']" mode="a:select-action">  
    <xsl:param name="action" select="/*/@action"/> 
    <xsl:param name="key" select="@action"/>
    <xsl:call-template name="a:select-action">
      <xsl:with-param name="action" select="$action"/>
      <xsl:with-param name="label" select="$o:new-actions-l10n[@key=$key]"/>
    </xsl:call-template>
  </xsl:template>
  
  <xsl:template match="a:node" mode="a:container-node" name="a:container-node">    
    <xsl:param name="l10n"/> 
    <!--xsl:param name="theme" select="$o:theme/l:context[@name='container-node']/*"/ -->
    <!-- xsl:variable name="edit" select="a:node-acls/a:acl[@action='edit']"/ -->
    <div class="actions-and-title">
            
      <div class='title'>
        <a href="{a:format-url(a:public-url(@uri))}" 
          title="{@tag}">
          <xsl:value-of select='@title'/>
        </a>
        <div class='spacer'/>   
      </div>   
      
      <div class='spacer'/>
    </div>
    
    <!-- already displayed as link title -->
    <!-- xsl:if test="$edit">
      <div class='metadata tag'>
        <span>
          <xsl:value-of select='a:tag'/>
        </span>
        <div class='spacer'/>   
      </div>
    </xsl:if  -->      
    
    <xsl:choose>
      <xsl:when test="@modified">
        <div class='metadata modified'>
          <span>
            <xsl:value-of select='substring-before(a:format-date(@modified),"T")'/>
          </span>
          <div class='spacer'/>   
        </div>
        <xsl:variable name="modifier" select="a:last-modifier"/>
        <xsl:if test="$modifier">
          <div class='metadata agent last-modifier'>        
            <xsl:apply-templates select="$modifier" mode="a:container-node-author">
              <xsl:with-param name="l10n" select="$l10n"/>
            </xsl:apply-templates>
            <div class='spacer'/>   
          </div>      
        </xsl:if> 
      </xsl:when>
      <xsl:when test="@created">
        <div class='metadata created'>
          <span>
            <xsl:value-of select='substring-before(a:format-date(@created),"T")'/>
          </span>
          <div class='spacer'/>   
        </div>     
        <xsl:variable name="creator" select="a:creator"/>  
        <xsl:if test="$creator">
          <div class='metadata agent creator'>        
            <xsl:apply-templates select="$creator" mode="a:container-node-author">
              <xsl:with-param name="l10n" select="$l10n"/>
            </xsl:apply-templates>
            <div class='spacer'/>   
          </div>      
        </xsl:if>          
      </xsl:when>
    </xsl:choose>  
    
    <div class="description">
      <span><xsl:value-of select="a:description"/></span>
      <div class="spacer"/>
    </div>
    
  </xsl:template> 
  
</xsl:stylesheet>

